package com.hzit.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzit.mapper.UserMapper;
import com.hzit.model.LayuiPage;
import com.hzit.model.User;
import com.hzit.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Resource
    private UserMapper userMapper;

/*    @Override
    public int insert(User user) {
        return userMapper.insert(user);
    }*/

    @Override
    public User selectById(Long id) {

        System.out.println("nihao");

        return userMapper.selectById(id);
    }

/*    @Override
    public void selectPage(LayuiPage<User> layuiPage) {

        //获取当前页
        int start = (layuiPage.getPage()-1)*layuiPage.getLimit();
        //保存设置当前页
        layuiPage.setStart(start);
        //获取data数据
        List<User> users = userMapper.selectPage(layuiPage);

//        for(User user:users){
//            Role role = new Role();
//            role.setRoleName("超级管理员");
//            role.setRoleCode("200");
//            user.setRole(role);
//        }

        //保存设置data数据
        layuiPage.setData(users);
        //保存设置总页数
        layuiPage.setCount(userMapper.selectPageCount(layuiPage));

    }*/


/*    @Override
    public int delete(Long id) {
        return userMapper.delete(id);
    }*/

/*    @Override
    public int updateById(User user) {
        return userMapper.updateById(user);

    }*/
}
